<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>本地直播</title>
	</head>
	<body>
		<div>autoplay 属性可以让视频自动播放</div>
		<video id="video" autoplay></video>
		<div>这个是远程获取的视频</div>
		<video id="recevie" autoplay></video>
	</body>
	<script>
		var opt = {
			audio: false, // 静音，免得让你听到声音太羞耻
			video: true,
		};
		navigator.mediaDevices
			.getUserMedia(opt)
			.then(function (mediaStream) {
				var video = document.querySelector("#video"); // 获取你书写的video标签
				video.srcObject = mediaStream; // 将媒体流塞进去！
			})
			.catch(function (err) {
				console.warn(err.name + ": " + err.message);
			});
	</script>
</html>
